<?php
/**
 * template name: Active Account
 * description: active account
 * @author Tham
 */
get_header();
?>
<div class="content">
    <div class="container">
        <div class="box-main">
            <div class="row">
                <div class="col-md-9">
                    <div class="tab">
                        <a href="<?php echo get_site_url(); ?>">Home / </a> <?php echo $post->post_title ?> </div>
                    <h2><?php echo $post->post_title ?> </h2>
                    <br/>
                    <div class="text-content border-radius modal-body">
                        <?php
                       
                        $id_user = $_REQUEST['note'];
                        $ds_user = User::get_user_by_userID($id_user);
                        $password = $ds_user[0]->user_pass;
                        $user_login = md5($ds_user[0]->user_nicename);
                        $md5_data   = md5('key')+$password ;
                        $key = $_REQUEST['key'];
                        $active = (int)$ds_user[0]->active;
                        if ($active == 0) {
                            if ($key == $md5_data) {


                                $forgot_pass = Helper :: rand_string(8);
                                User :: ActiveAccount($id_user, $forgot_pass);
                                MailHelper :: SendMailActive($id_user);
                                ?>
                                Your account has been activated sucessfully<br/><br/>
                                Please  you <a style="color:#003300" href="<?php echo get_site_url(); ?>/login">click here</a> to change your infomation
                                <?php
                            } else {
                                ?>
                                Please you check your link activate
                                <?php
                            }
                        } else {
                            ?>
                            Your Account has already activated <br/><br/>
                            Please  you <a style="color:#003300" href="<?php echo get_site_url(); ?>/login">click here</a> to change your information
                            <?php
                        }
                        // print_r($ds_user);
                        
                        ?>   

                    </div>                              
               </div>
                <?php
                include_once 'right_single.php';
                ?>
            </div>
        </div>
    </div>
</div>


<?php get_footer(); ?>